//let Name: string = "我是一个好学生！";
//let Name = "6666";

//const MyName: string = "布吉岛";
//MyName = "22333";

let Name1: boolean = false;

let Name2: number = 0xf00d;

let Name3: String = "asashi";

let Name4: number[] = [1, 2, 3];

let Name5: Array<number> = [1, 2, 3];

let Name7: void = undefined;

function Name6(): void {
  console.log("welcome to Chinese");
}

declare function Name8(o: object | null): void;

const Name10: object = { name: "bujidoa", age: 10, sex: "男", boolean: true };

function add_a(x: number, y: number) {
  return x + y;
}

let myAdd5 = function(x: number, y: number): number {
  return x + y;
};

add_a(1, 2);

function add_b(x: string, y?: string, z?: string) {
  return x + y;
}

function build_name(
  firstName: string | number | boolean,
  ...endName: string[]
) {
  return firstName + "" + endName.join("");
}

build_name(1, "yang");
build_name("sd", "sd", "ds", "dfd");

add_b("wang", "lam");
add_b("lansd");

function buildName(firstName: string, lastName = "Smith") {
  return firstName + " " + lastName;
}

buildName("s");

function buildName5(firstName = "Will", lastName: string) {
  return firstName + " " + lastName;
}

buildName5("dsd", "sdsd");

function build_name1(firstName: string | number, ...endName: string[]) {
  if (typeof firstName === "number" && typeof endName === "number") {
    return firstName + endName;
  } else if (typeof firstName === "string" && typeof endName === "string") {
    return firstName + endName;
  } else {
    return firstName.toString() + endName.toString();
  }
}
